#include <cstdio>
#define INF 1000000000
#define max(a,b) (((a)>(b))?(a):(b))

struct Node
{
    int x, d;
    Node( ) { }
    Node( int _x, int _d )
        : x( _x ), d( _d ) { }
};

int f[ 101 ][ 10001 ], sum[ 101 ][ 10001 ], a[ 101 ][ 10001 ], n, m, x, t;
Node q1[ 10001 ], q2[ 10001 ];
int head1, tail1, head2, tail2;

void init( )
{
    int i, j;
    for ( i = 0; i < n; i++ )
    {
        sum[ i ][ 0 ] = 0;
        for ( j = 1; j <= m; j++ )
        {
            scanf("%d", &a[ i ][ j ]);
            sum[ i ][ j ] = sum[ i ][ j - 1 ] + a[ i ][ j ];
        }
    }
    for ( i = 1; i <= m; i++ )
        f[ 0 ][ i ] = -INF;
    f[ 0 ][ x ] = 0;
}

void work( )
{
    int i, j, ans = -INF;
    for ( i = 1; i <= n; i++ )
    {
        head1 = head2 = tail1 = tail2 = 0;
        for ( j = 1; j <= t; j++ )
        {
            while ( tail1 > head1 && q1[ tail1 - 1 ].d < f[ i - 1 ][ j ] + sum[ i - 1 ][ j ] ) tail1--;
            q1[ tail1++ ] = Node( j, f[ i - 1 ][ j ] + sum[ i - 1 ][ j ] );
        }
        for ( j = 1; j <= m; j++ )
        {
            while ( tail2 > head2 && j - q2[ head2 ].x > t ) head2++;
            while ( tail2 > head2 && q2[ tail2 - 1 ].d < f[ i - 1 ][ j ] - sum[ i - 1 ][ j - 1 ] ) tail2--;
            q2[ tail2++ ] = Node( j, f[ i - 1 ][ j ] - sum[ i - 1 ][ j - 1 ] );
            while ( q1[ head1 ].x < j ) head1++;
            if ( j + t <= m )
            {
                while ( tail1 > head1 && q1[ tail1 - 1 ].d < f[ i - 1 ][ j + t ] + sum[ i - 1 ][ j + t ] ) tail1--;
                q1[ tail1++ ] = Node( j + t, f[ i - 1 ][ j + t ] + sum[ i - 1 ][ j + t ] );
            }
            f[ i ][ j ] = max( q1[ head1 ].d - sum[ i - 1 ][ j - 1 ], q2[ head2 ].d + sum[ i - 1 ][ j ] );
        }
    }
    for ( i = 1; i <= m; i++ )
        ans = max( ans, f[ n ][ i ]);
    printf("%d\n", ans);
}

int main( )
{
    while ( scanf("%d%d%d%d", &n, &m, &x, &t) != EOF )
    {
        init( );
        work( );
    }
    return 0;
}
